//
//  TransferTableDataSource.swift
//  甜言蜜语
//
//  Created by 王剑伟 on 16/7/15.
//  Copyright © 2016年 wl. All rights reserved.
//

import UIKit

class TransferTableDataSource: NSObject, UITableViewDataSource, UITableViewDelegate {
    var modelList: [TransferModel]? {
        didSet {
            self.tableView?.reloadData()
        }
    }
    var tableView: UITableView!
    
   func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
          return 108
    }
        
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        if let count = self.modelList?.count {
            return count
        }
        
        return 0
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("TransferTableViewCell", forIndexPath: indexPath) as! TransferTableViewCell
        
        // Configure the cell...
        let model = self.modelList![indexPath.row]
        cell.icon.sd_setImageWithURL(NSURL(string: model.imgsrc))
        cell.title.text = model.name
        cell.address.text = model.address
        cell.type.text = model.type
        cell.describe.text = model.newold
        cell.price.text = model.price
        cell.time.text = publicMethod.computationTimeDifference(model.ptime)
        
        return cell
    }
    
    
}